#include <stdio.h>

int MaxSubseqSum1(int A[], int N)
{
    int ThisSum, MaxSum = 0;

    for (int i = 0; i < N; i++) 
    {
        for (int j = i; j < N; j++)
        {
            ThisSum = 0;
            for (int k = i; k <= j; k++)
            {
                ThisSum += A[k];
            }
            if (ThisSum > MaxSum)
                MaxSum = ThisSum;
        }
    }
    return MaxSum > 0 ? MaxSum : 0;
}

int main()
{
    int List[] = {-2, 11, -4, 13, -5, -2};
    printf("%d\n", MaxSubseqSum1(List, 6));
    return 0;
}